home *** CD-ROM | disk | FTP | other *** search
/ Euroscene 2 / Euroscene 2.iso / USEFUL / DeliTracker130 / Developer / Developer.run / Examples / SoundMon.s < prev    next >
Encoding:
Text File  |  1992-09-23  |  16.5 KB  |  698 lines

  1.  
  2.     incdir    "Includes:"
  3.     include "misc/DeliPlayer.i"
  4.  
  5. ;
  6. ;
  7.     SECTION Player,Code
  8. ;
  9. ;
  10.  
  11.     PLAYERHEADER PlayerTagArray
  12.  
  13.     dc.b '$VER: SoundMon 2.0 player module V1.5 (03 Sep 92)',0
  14.     even
  15.  
  16. PlayerTagArray
  17.     dc.l    DTP_PlayerVersion,1
  18.     dc.l    DTP_PlayerName,PName
  19.     dc.l    DTP_Creator,CName
  20.     dc.l    DTP_Check2,Chk
  21.     dc.l    DTP_Interrupt,Int
  22.     dc.l    DTP_Config,Config
  23.     dc.l    DTP_InitPlayer,InitPlay
  24.     dc.l    DTP_EndPlayer,EndPlay
  25.     dc.l    DTP_InitSound,InitSnd
  26.     dc.l    DTP_EndSound,RemSnd
  27.     dc.l    TAG_DONE
  28.     
  29. *-----------------------------------------------------------------------*
  30. ;
  31. ; Player/Creatorname und lokale Daten
  32.  
  33. PName    dc.b 'SoundMon',0
  34. CName    dc.b '???,',10
  35.     dc.b 'adapted by Delirium',0
  36.     even
  37.  
  38. *-----------------------------------------------------------------------*
  39. ;
  40. ;Interrupt für Replay
  41.  
  42. Int
  43.     movem.l    d0-d7/a0-a6,-(sp)
  44.     jsr    bpmusic             ; DudelDiDum
  45.     movem.l    (sp)+,d0-d7/a0-a6
  46.     rts
  47.  
  48. *-----------------------------------------------------------------------*
  49. ;
  50. ; Testet auf SoundMon-Modul
  51.  
  52. Chk                        ; SoundMon V2 ?
  53.     move.l    dtg_ChkData(a5),a0
  54.     move.l    $1a(a0),d0
  55.     lsr.l    #8,d0
  56.     subi.l    #"V.2",d0
  57.     rts
  58.  
  59. *-----------------------------------------------------------------------*
  60. ;
  61. ; Einmalige Initialisierung des Players
  62.  
  63. Config
  64.     lea    null,a0
  65.     lea    bp_buffer,a1
  66.     move.w    #bpsong-null-1,d0
  67. ConfigCopy
  68.     move.b    (a0)+,(a1)+
  69.     dbra    d0,ConfigCopy
  70.  
  71.     moveq    #0,d0                ; no Error
  72.     rts
  73.  
  74. *-----------------------------------------------------------------------*
  75. ;
  76. ; Init Player
  77.  
  78. InitPlay
  79.     moveq    #0,d0
  80.     move.l    dtg_GetListData(a5),a0        ; Function
  81.     jsr    (a0)
  82.     move.l    a0,bpsong
  83.  
  84.     move.l    dtg_AudioAlloc(a5),a0        ; Function
  85.     jsr    (a0)                ; returncode is already set !
  86.     rts
  87.  
  88. *-----------------------------------------------------------------------*
  89. ;
  90. ; End Player
  91.  
  92. EndPlay
  93.     move.l    dtg_AudioFree(a5),a0        ; Function
  94.     jsr    (a0)
  95.     rts
  96.  
  97. *-----------------------------------------------------------------------*
  98. ;
  99. ; Init Sound
  100.  
  101. InitSnd
  102.     lea    bp_buffer,a0
  103.     lea    null,a1
  104.     move.w    #bpsong-null-1,d0
  105. InitSndCopy
  106.     move.b    (a0)+,(a1)+
  107.     dbra    d0,InitSndCopy
  108.  
  109.     jsr    bpinit                ; Init Sound
  110.     rts
  111.  
  112.  
  113. *-----------------------------------------------------------------------*
  114. ;
  115. ; Remove Sound
  116.  
  117. RemSnd
  118.     lea    $dff000,a0
  119.     moveq    #0,d0
  120.     move.w    d0,$a8(a0)
  121.     move.w    d0,$b8(a0)
  122.     move.w    d0,$c8(a0)
  123.     move.w    d0,$d8(a0)
  124.     move.w    #$000F,$96(a0)            ; End Sound
  125.     rts
  126.  
  127. *-----------------------------------------------------------------------*
  128. ;
  129. ; Bp SoundMon V2.0 - Replay
  130.  
  131. ;
  132. ;
  133.     SECTION Replay,Code_C
  134. ;
  135. ;
  136.  
  137. ;    ©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
  138. ;    ©©                                                  ©©
  139. ;    ©©        Soundmonitor V2.0 - Replay Routine        ©©
  140. ;    ©©  Modified to run in DEVPAC ][ by STARR 26/03/90  ©©
  141. ;    ©©                                                  ©©
  142. ;    ©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
  143.  
  144. bpinit:        lea samples(pc),a0
  145.         move.l bpsong(pc),a1
  146.         clr.b numtables
  147.         cmpi.w #'V.',26(a1)
  148.         bne.s bpnotv2
  149.         cmpi.b #'2',28(a1)
  150.         bne.s bpnotv2
  151.         move.b 29(a1),numtables
  152. bpnotv2:    move.l #512,d0
  153.         move.w 30(a1),d1        ;d1 now contains length in steps
  154.         moveq.l #1,d2             ;1 is highest pattern number
  155.         mulu #4,d1             ;4 voices per step
  156.         subq.w #1,d1             ;correction for DBRA
  157. findhighest:    cmp.w (a1,d0),d2        ;Is it higher
  158.         bge.s nothigher            ;No
  159.         move.w (a1,d0),d2        ;Yes, so let D2 be highest
  160. nothigher:    addq.l #4,d0             ;Next Voice
  161.         dbf d1,findhighest        ;And search
  162.         move.w 30(a1),d1
  163.         lsl.w #4,d1             ;16 bytes per step
  164.         move.l #512,d0             ;header is 512 bytes
  165.         mulu #48,d2             ;48 bytes per pattern
  166.         add.l d2,d0
  167.         add.l d1,d0             ;offset for samples
  168.         add.l bpsong,d0
  169.         move.l d0,tables
  170.         moveq.l #0,d1
  171.         move.b numtables,d1        ;Number of tables
  172.         lsl.l #6,d1             ;x 64
  173.         add.l d1,d0
  174.         move.l #14,d1             ;15 samples
  175.         add.l #32,a1
  176. initloop:    move.l d0,(a0)+
  177.         cmpi.b #$ff,(a1)
  178.         beq.s bpissynth
  179.         move.w 24(a1),d2
  180.         add.w d2,d2
  181.         add.l d2,d0             ;offset next sample
  182. bpissynth:    add.l #32,a1             ;Length of Sample Part in header
  183.         dbra d1,initloop
  184.         rts
  185.  
  186. bpmusic:    bsr bpsynth
  187.         subq.b #1,arpcount
  188.         moveq.l #3,d0
  189.         lea bpcurrent(pc),a0
  190.         move.l #$dff0a0,a1
  191. bploop1:    move.b 12(a0),d4
  192.         ext.w d4
  193.         add.w d4,(a0)
  194.         tst.b $1e(a0)
  195.         bne.s bplfo
  196.         move.w (a0),6(a1)
  197. bplfo:        move.l 4(a0),(a1)
  198.         move.w 8(a0),4(a1)
  199.         tst.b 11(a0)
  200.         bne.s bpdoarp
  201.         tst.b 13(a0)
  202.         beq.s not2
  203. bpdoarp:    tst.b arpcount
  204.         bne.s not0
  205.         move.b 11(a0),d3
  206.         move.b 13(a0),d4
  207.         and.w #240,d4
  208.         and.w #240,d3
  209.         lsr.w #4,d3
  210.         lsr.w #4,d4
  211.         add.w d3,d4
  212.         add.b 10(a0),d4
  213.         bsr bpplayarp
  214.         bra.s not2
  215. not0:        cmpi.b #1,arpcount 
  216.         bne.s not1
  217.         move.b 11(a0),d3
  218.         move.b 13(a0),d4
  219.         and.w #15,d3
  220.         and.w #15,d4
  221.         add.w d3,d4
  222.         add.b 10(a0),d4
  223.         bsr bpplayarp
  224.         bra.s not2
  225. not1:        move.b 10(a0),d4
  226.         bsr bpplayarp
  227. not2:        lea $10(a1),a1
  228.         lea $20(a0),a0
  229.         dbra d0,bploop1
  230.         tst.b arpcount
  231.         bne.s arpnotzero
  232.         move.b #3,arpcount
  233. arpnotzero:    subq.b #1,bpcount
  234.         beq.s bpskip1
  235.         rts
  236. bpskip1:    move.b bpdelay,bpcount
  237. bpplay:        bsr.s bpnext
  238.         move.w dma,$dff096
  239.         move.l #$1f4,d0        ;is this a waste ?????
  240. bpxx:        dbra d0,bpxx
  241.         moveq.l #3,d0
  242.         move.l #$dff0a0,a1
  243.         moveq #1,d1
  244.         lea bpcurrent(pc),a2
  245.         lea bpbuffer(pc),a5
  246. bploop2:    btst #15,(a2)
  247.         beq.s bpskip7
  248.         bsr bpplayit
  249. bpskip7:    asl.w #1,d1
  250.         lea $10(a1),a1
  251.         lea $20(a2),a2
  252.         lea $24(a5),a5
  253.         dbra d0,bploop2
  254.         rts
  255. bpnext:        clr.w dma
  256.         move.l bpsong(pc),a0
  257.         move.l #$dff0a0,a3
  258.         moveq.l #3,d0
  259.         moveq #1,d7
  260.         lea bpcurrent(pc),a1
  261. bploop3:    moveq.l #0,d1
  262.         move.w bpstep,d1
  263.         lsl.w #4,d1
  264.         move.l d0,d2
  265.         lsl.l #2,d2
  266.         add.l d2,d1
  267.         add.l #512,d1
  268.         move.w (a0,d1),d2
  269.         move.b 2(a0,d1),st
  270.         move.b 3(a0,d1),tr
  271.         subq.w #1,d2
  272.         mulu #48,d2
  273.         moveq.l #0,d3
  274.         move.w 30(a0),d3
  275.         lsl.w #4,d3
  276.         add.l d2,d3
  277.         move.l #$00000200,d4
  278.         move.b bppatcount,d4
  279.         add.l d3,d4
  280.         move.l d4,a2
  281.         add.l a0,a2
  282.         moveq.l #0,d3 
  283.         move.b (a2),d3
  284.         tst.b d3
  285.         bne.s bpskip4
  286.         bra bpoptionals
  287. bpskip4:    clr.w 12(a1)              ;Clear autoslide/autoarpeggio
  288.         move.b 1(a2),d4
  289.         and.b #15,d4
  290.         cmpi.b #10,d4            ;Option 10->transposes off
  291.         bne.s bp_do1
  292.         move.b 2(a2),d4
  293.         and.b #240,d4              ;Higher nibble=transpose
  294.         bne.s bp_not1
  295. bp_do1:        add.b tr,d3
  296.         ext.w d3
  297. bp_not1:    move.b d3,10(a1)         ; Voor Arpeggio's
  298.         lea bpper(pc),a4
  299.         lsl.w #1,d3
  300.         move.w -2(a4,d3.w),(a1)
  301.         bset #15,(a1)
  302.         move.b #$ff,2(a1)
  303.         moveq #0,d3
  304.         move.b 1(a2),d3
  305.         lsr.b #4,d3
  306.         and.b #15,d3
  307.         tst.b d3
  308.         bne.s bpskip5
  309.         move.b 3(a1),d3 
  310. bpskip5:     move.b 1(a2),d4
  311.         and.b #15,d4
  312.         cmpi.b #10,d4             ;option 10
  313.         bne.s bp_do2
  314.         move.b 2(a2),d4
  315.         and.b #15,d4
  316.         bne.s bp_not2
  317. bp_do2:        add.b st,d3
  318. bp_not2:    cmpi.w #1,8(a1)
  319.         beq.s bpsamplechange
  320.         cmp.b 3(a1),d3
  321.         beq.s bpoptionals
  322. bpsamplechange:    move.b d3,3(a1)
  323.         or.w d7,dma
  324. bpoptionals:     moveq.l #0,d3
  325.         moveq.l #0,d4
  326.         move.b 1(a2),d3
  327.         and.b #15,d3
  328.         move.b 2(a2),d4
  329.         cmpi.b #0,d3            ; Optionals Here
  330.         bne.s notopt0
  331.         move.b d4,11(a1)
  332. notopt0:    cmpi.b #1,d3
  333.         bne.s bpskip3
  334.         move.w d4,8(a3)
  335.         move.b d4,2(a1)         ; Volume ook in BPCurrent
  336. bpskip3:    cmpi.b #2,d3              ; Set Speed
  337.         bne.s bpskip9
  338.         move.b d4,bpcount
  339.         move.b d4,bpdelay
  340. bpskip9:    cmpi.b #3,d3             ; Filter = LED control
  341.         bne.s bpskipa
  342.         tst.b d4
  343.         bne.s bpskipb
  344.         bset #1,$bfe001
  345.         bra.s bpskip2
  346. bpskipb:    bclr #1,$bfe001
  347. bpskipa:    cmpi.b #4,d3             ; PortUp
  348.         bne.s noportup
  349.         sub.w d4,(a1)             ; Slide data in BPCurrent
  350.         clr.b 11(a1)             ; Arpeggio's uit
  351. noportup:    cmpi.b #5,d3             ; PortDown
  352.         bne.s noportdn
  353.         add.w d4,(a1)             ; Slide down
  354.         clr.b 11(a1)
  355. noportdn:    cmpi.b #6,d3            ; SetRepCount
  356.         bne.s notopt6
  357.         move.b d4,bprepcount
  358. notopt6:    cmpi.b #7,d3            ; DBRA repcount
  359.         bne.s notopt7
  360.         subq.b #1,bprepcount
  361.         beq.s notopt7
  362.         move.w d4,bpstep
  363. notopt7:    cmpi.b #8,d3            ;Set AutoSlide
  364.         bne.s notopt8
  365.         move.b d4,12(a1)
  366. notopt8:    cmpi.b #9,d3            ;Set AutoArpeggio
  367.         bne.s notopt9
  368.         move.b d4,13(a1)
  369. notopt9:
  370. bpskip2:    lea $10(a3),a3
  371.         lea $20(a1),a1
  372.         asl.w #1,d7
  373.         dbra d0,bploop3   
  374.         addq.b #3,bppatcount
  375.         cmpi.b #48,bppatcount
  376.         bne.s bpskip8
  377.         move.b #0,bppatcount
  378.         addq.w #1,bpstep
  379.         move.l bpsong(pc),a0
  380.         move.w 30(a0),d1
  381.         cmp.w bpstep,d1
  382.         bne.s bpskip8
  383.         move.w #0,bpstep
  384. bpskip8:    rts
  385. bpplayit:    bclr #15,(a2)
  386.         tst.l (a5)             ;Was EG used
  387.         beq.s noeg1             ;No ??
  388.         moveq #0,d3             ;Well then copy
  389.         move.l (a5),a4             ;Old waveform back
  390.         moveq #7,d7             ;to waveform tables
  391. eg1loop:    move.l 4(a5,d3.w),(a4)+        ;Copy...
  392.         addq.w #4,d3             ;Copy...
  393.         dbra d7,eg1loop            ;Copy...
  394. noeg1:        move.w (a2),6(a1)        ;Period from bpcurrent
  395.         moveq.l #0,d7
  396.         move.b 3(a2),d7            ;Instrument number
  397.         move.l d7,d6             ;Also in d6
  398.         lsl.l #5,d7             ;Header offset    
  399.         move.l bpsong(pc),a3
  400.         cmpi.b #$ff,(a3,d7.w)        ;Is synthetic
  401.         beq.s bpplaysynthetic        ;Yes ??
  402.         clr.l (a5)             ;EG Off
  403.         clr.b $1a(a2)             ;Synthetic mode off
  404.         clr.w $1e(a2)             ;Lfo Off
  405.         add.l #24,d7             ;24 is name->ignore
  406.         lsl.l #2,d6             ;x4 for sample offset
  407.         move.l #samples,a4
  408.         move.l -4(a4,d6),d4        ;Fetch sample pointer
  409.         beq.s bp_nosamp            ;is zero->no sample
  410.         move.l d4,(a1)             ;Sample pointer in hardware
  411.         move.w (a3,d7),4(a1)        ;length in hardware
  412.         move.b 2(a2),9(a1)        ;and volume from bpcurrent
  413.         cmpi.b #$ff,2(a2)        ;Use default volume
  414.         bne.s skipxx             ;No ??
  415.         move.w 6(a3,d7),8(a1)        ;Default volume in hardware
  416. skipxx:     move.w 4(a3,d7),8(a2)        ;Length in bpcurrent
  417.         moveq.l #0,d6
  418.         move.w 2(a3,d7),d6        ;Calculate repeat
  419.         add.l d6,d4
  420.         move.l d4,4(a2)            ;sample start in bpcurrent
  421.         cmpi.w #1,8(a2)            ;has sample repeat part
  422.         bne.s bpskip6             ;Yes ??
  423. bp_nosamp:    move.l #null,4(a2)        ;Play no sample
  424.         bra.s bpskip10
  425. bpskip6:    move.w 8(a2),4(a1)        ;Length to hardware
  426.         move.l 4(a2),(a1)        ;pointer to hardware
  427. bpskip10:    or.w #$8000,d1            ;Turn on DMA for this voice
  428.         move.w d1,$dff096        ;Yeah, do it
  429.         rts
  430. bpplaysynthetic:move.b #$1,$1a(a2)        ;Synthetic mode on
  431.         clr.w $e(a2)             ;EG Pointer restart
  432.         clr.w $10(a2)             ;LFO Pointer restart
  433.         clr.w $12(a2)             ;ADSR Pointer restart
  434.         move.w 22(a3,d7.w),$14(a2)    ;EG Delay
  435.         addq.w #1,$14(a2)        ;0 is nodelay
  436.         move.w 14(a3,d7.w),$16(a2)    ;LFO Delay
  437.         addq.w #1,$16(a2)        ;So I need correction
  438.         move.w #1,$18(a2)        ;ADSR Delay->Start immediate
  439.         move.b 17(a3,d7.w),$1d(a2)    ;EG OOC
  440.         move.b 9(a3,d7.w),$1e(a2)    ;LFO OOC
  441.         move.b 4(a3,d7.w),$1f(a2)    ;ADSR OOC
  442.         move.b 19(a3,d7.w),$1c(a2)    ;Current EG Value
  443.         move.l tables,a4        ; so far so good,now what ??
  444.         moveq.l #0,d3            ;Pointer to waveform tables
  445.         move.b 1(a3,d7.w),d3        ;Which waveform
  446.         lsl.l #6,d3             ;x64 is length waveform table
  447.         add.l d3,a4
  448.         move.l a4,(a1)             ;Sample Pointer
  449.         move.l a4,4(a2)            ;In bpcurrent
  450.         move.w 2(a3,d7.w),4(a1)        ;Length in words
  451.         move.w 2(a3,d7.w),8(a2)        ;Length in bpcurrent
  452.         tst.b 4(a3,d7.w)        ;Is ADSR on
  453.         beq.s bpadsroff            ;No ??
  454.         move.l tables,a4        ;Tables
  455.         moveq.l #0,d3
  456.         move.b 5(a3,d7.w),d3        ;ADSR table number
  457.         lsl.l #6,d3             ;x64 for length
  458.         add.l d3,a4             ;Add it
  459.         moveq #0,d3
  460.         move.b (a4),d3             ;Get table value
  461.         add.b #128,d3             ;I want it from 0..255
  462.         lsr.w #2,d3             ;Divide by 4->0..63
  463.         cmpi.b #$ff,2(a2)
  464.         bne.s bpskip99
  465.         move.b 25(a3,d7.w),2(a2)
  466. bpskip99:    moveq #0,d4
  467.         move.b 2(a2),d4            ;Default volume
  468.         mulu d4,d3             ;default maal init volume
  469.         lsr.w #6,d3             ;divide by 64
  470.         move.w d3,8(a1)            ;is new volume
  471.         bra.s bpflipper
  472. bpadsroff:    move.b 2(a2),9(a1)
  473.         cmpi.b #$ff,2(a2)
  474.         bne.s bpflipper            ;No ADSR
  475.         move.b 25(a3,d7.w),9(a1)    ;So use default volume
  476. bpflipper:    move.l 4(a2),a4            ;Pointer on waveform
  477.         move.l a4,(a5)             ;Save it
  478.         moveq #0,d3             ;Save Old waveform
  479.         moveq #7,d4             ;data in bpbuffer
  480. eg2loop:    move.l (a4,d3.w),4(a5,d3.w)
  481.         addq.w #4,d3             ;Copy         
  482.         dbra d4,eg2loop
  483.         tst.b 17(a3,d7.w)        ;EG off
  484.         beq bpskip10            ;Yes ??
  485.         tst.b 19(a3,d7.w)        ;Is there an init value for EG
  486.         beq bpskip10            ;No ??
  487.         moveq.l #0,d3
  488.         move.b 19(a3,d7.w),d3
  489.         lsr.l #3,d3             ;Divide by 8 ->0..31
  490.         move.b d3,$1c(a2)        ;Current EG Value
  491.         subq.l #1,d3             ;-1,DBRA correction
  492. eg3loop:    neg.b (a4)+
  493.         dbra d3,eg3loop
  494.         bra bpskip10
  495. bpplayarp:    lea bpper(pc),a4
  496.         ext.w d4
  497.         asl.w #1,d4
  498.         move.w -2(a4,d4.w),6(a1)
  499.         rts
  500. bpsynth:    move.l #3,d0
  501.         lea bpcurrent(pc),a2
  502.         lea $dff0a0,a1
  503.         move.l bpsong(pc),a3
  504.         lea bpbuffer(pc),a5
  505. bpsynthloop:    tst.b $1a(a2)             ;Is synthetic sound
  506.         beq.s bpnosynth            ;No ??
  507.         bsr.s bpyessynth            ;Yes         
  508. bpnosynth:    lea $24(a5),a5
  509.         lea $20(a2),a2
  510.         lea $10(a1),a1
  511.         dbra d0,bpsynthloop
  512.         rts
  513. bpyessynth:    moveq #0,d7
  514.         move.b 3(a2),d7            ;Which instr. was I playing
  515.         lsl.w #5,d7             ;x32, is length of instr.
  516.         tst.b $1f(a2)             ;ADSR off
  517.         beq.s bpendadsr            ;Yes ??
  518.         subq.w #1,$18(a2)        ;Delay,May I
  519.         bne.s bpendadsr            ;No ??
  520.         moveq.l #0,d3
  521.         move.b 8(a3,d7.w),d3
  522.         move.w d3,$18(a2)        ;Reset Delay Counter
  523.         move.l tables,a4
  524.         move.b 5(a3,d7.w),d3        ;Which ADSR table
  525.         lsl.l #6,d3             ;x64
  526.         add.l d3,a4             ;This is my table
  527.         move.w $12(a2),d3        ;Get ADSR table pointer
  528.         moveq #0,d4
  529.         move.b (a4,d3.w),d4        ;Value from table
  530.         add.b #128,d4             ;Want it from 0..255
  531.         lsr.w #2,d4             ;And now from 0..63
  532.         moveq #0,d3
  533.         move.b 2(a2),d3            ;Current Volume
  534.         mulu d3,d4             ;MultiPly with table volume
  535.         lsr.w #6,d4             ;Divide by 64=New volume
  536.         move.w d4,8(a1)            ;Volume in hardware
  537.         addq.w #1,$12(a2)        ;Increment of ADSR pointer
  538.         move.w 6(a3,d7.w),d4        ;Length of adsr table
  539.         cmp.w $12(a2),d4        ;End of table reached
  540.         bne.s bpendadsr            ;No ??
  541.         clr.w $12(a2)             ;Clear ADSR Pointer
  542.         cmpi.b #1,$1f(a2)        ;Once
  543.         bne.s bpendadsr            ;No ??
  544.         clr.b $1f(a2)             ;ADSR off
  545. bpendadsr:    tst.b $1e(a2)             ;LFO On
  546.         beq.s bpendlfo            ;No ??
  547.         subq.w #1,$16(a2)        ;LFO delay,May I
  548.         bne.s bpendlfo            ;No
  549.         moveq.l #0,d3
  550.         move.b 16(a3,d7.w),d3
  551.         move.w d3,$16(a2)        ;Set LFO Count
  552.         move.l tables,a4
  553.         move.b 10(a3,d7.w),d3        ;Which LFO table
  554.         lsl.l #6,d3             ;x64
  555.         add.l d3,a4
  556.         move.w $10(a2),d3        ;LFO pointer
  557.         moveq.l #0,d4
  558.         move.b (a4,d3.w),d4        ;That's my value
  559.         ext.w d4             ;Make it a word
  560.         ext.l d4             ;And a longword
  561.         moveq.l #0,d5
  562.         move.b 11(a3,d7.w),d5        ;LFO depth
  563.         tst.b d5
  564.         beq.s bpnotx
  565.         divs d5,d4             ;Calculate it
  566. bpnotx:        move.w (a2),d5             ;Period
  567.         add.w d4,d5             ;New Period
  568.         move.w d5,6(a1)            ;In hardware
  569.         addq.w #1,$10(a2)        ;Next position
  570.         move.w 12(a3,d7.w),d3        ;LFO table Length
  571.         cmp.w $10(a2),d3        ;End Reached
  572.         bne.s bpendlfo            ;NO ??
  573.         clr.w $10(a2)             ;Reset LFO Pointer
  574.         cmpi.b #1,$1e(a2)        ;Once LFO
  575.         bne.s bpendlfo            ;NO ??
  576.         clr.b $1e(a2)             ;LFO Off
  577. bpendlfo:    tst.b $1d(a2)             ;EG On
  578.         beq bpendeg             ;No ??
  579.         subq.w #1,$14(a2)        ;EG delay,May I
  580.         bne bpendeg             ;No
  581.         tst.l (a5)
  582.         beq.s bpendeg
  583.         moveq.l #0,d3
  584.         move.b 24(a3,d7.w),d3
  585.         move.w d3,$14(a2)        ;Set EG Count
  586.         move.l tables,a4
  587.         move.b 18(a3,d7.w),d3        ;Which EG table
  588.         lsl.l #6,d3             ;x64
  589.         add.l d3,a4
  590.         move.w $e(a2),d3        ;EG pointer
  591.         moveq.l #0,d4
  592.         move.b (a4,d3.w),d4        ;That's my value
  593.         move.l (a5),a4             ;Pointer to waveform
  594.         add.b #128,d4             ;0..255
  595.         lsr.l #3,d4             ;0..31
  596.         moveq.l #0,d3
  597.         move.b $1c(a2),d3        ;Old EG Value
  598.         move.b d4,$1c(a2)
  599.         add.l d3,a4             ;WaveForm Position
  600.         move.l a5,a6             ;Buffer
  601.         add.l d3,a6             ;Position
  602.         addq.l #4,a6             ;For adress in buffer
  603.         cmp.b d3,d4             ;Compare old with new value
  604.         beq.s bpnexteg            ;no change ??
  605.         bgt bpishigh            ;new value is higher
  606. bpislow:    sub.l d4,d3             ;oldvalue-newvalue
  607.         subq.l #1,d3             ;Correction for DBRA
  608. bpegloop1a:    move.b -(a6),d4
  609.         move.b d4,-(a4)
  610.         dbra d3,bpegloop1a  
  611.         bra.s bpnexteg
  612. bpishigh:    sub.l d3,d4             ;Newvalue-oldvalue
  613.         subq.l #1,d4             ;Correction for DBRA
  614. bpegloop1b:    move.b (a6)+,d3
  615.         neg.b d3
  616.         move.b d3,(a4)+            ;DoIt
  617.         dbra d4,bpegloop1b
  618. bpnexteg:    addq.w #1,$e(a2)        ;Next position
  619.         move.w 20(a3,d7.w),d3        ;EG table Length
  620.         cmp.w $e(a2),d3            ;End Reached
  621.         bne.s bpendeg             ;NO ??
  622.         clr.w $e(a2)             ;Reset EG Pointer
  623.         cmpi.b #1,$1d(a2)        ;Once EG
  624.         bne.s bpendeg             ;NO ??
  625.         clr.b $1d(a2)             ;EG Off
  626. bpendeg:    rts
  627.  
  628. null:        dc.l 0
  629.  
  630. bpcurrent:    dc.w 0,0            ;periode,instrument =(volume.b,instr nr.b)
  631.         dc.l null            ;start
  632.         dc.w 1                ;length (words)
  633.         dc.b 0,0,0,0             ;noot,arpeggio,autoslide,autoarpeggio
  634.         dc.w 0,0,0            ;EG,LFO,ADSR pointers
  635.         dc.w 0,0,0            ;EG,LFO,ADSR count
  636.         dc.b 0,0            ;Synthetic yes/no, Volume Slide
  637.         dc.b 0,0            ;Current EG value,EG OOC
  638.         dc.b 0,0            ;LFO OOC,ADSR OOC
  639.  
  640.         dc.w 0,0
  641.         dc.l null
  642.         dc.w 1,0,0
  643.         dc.w 0,0,0,0,0,0,0,0,0
  644.  
  645.         dc.w 0,0
  646.         dc.l null
  647.         dc.w 1,0,0
  648.         dc.w 0,0,0,0,0,0,0,0,0
  649.  
  650.         dc.w 0,0
  651.         dc.l null
  652.         dc.w 1,0,0
  653.         dc.w 0,0,0,0,0,0,0,0,0
  654.  
  655. bpstep:        dc.w 0
  656. bppatcount:    dc.b 0
  657. st:        dc.b 0
  658. tr:        dc.b 0
  659. bpcount:    dc.b 1
  660. bpdelay:    dc.b 6
  661. arpcount:    dc.b 1
  662. bprepcount:    dc.b 1
  663. numtables:    dc.b 0
  664.  
  665. even
  666.  
  667. dma:        dc.w 0
  668. tables:        dc.l 0
  669.  
  670. bpbuffer:    
  671.         dcb.b 144,0
  672.         dc.w 6848,6464,6080,5760,5440,5120,4832,4576,4320,4064,3840,3616
  673.         dc.w 3424,3232,3040,2880,2720,2560,2416,2288,2160,2032,1920,1808
  674.         dc.w 1712,1616,1520,1440,1360,1280,1208,1144,1080,1016,0960,0904
  675.  
  676. bpper:        dc.w 0856,0808,0760,0720,0680,0640,0604,0572,0540,0508,0480,0452
  677.         dc.w 0428,0404,0380,0360,0340,0320,0302,0286,0270,0254,0240,0226
  678.         dc.w 0214,0202,0190,0180,0170,0160,0151,0143,0135,0127,0120,0113
  679.         dc.w 0107,0101,0095,0090,0085,0080,0076,0072,0068,0064,0060,0057
  680.  
  681. samples:    dcb.l 15,0
  682.  
  683. bpsong:        dc.l 0
  684.  
  685.  
  686. *-----------------------------------------------------------------------*
  687. ;
  688. ; BSS Hunk (Datenbuffer)
  689.  
  690. ;
  691. ;
  692.     SECTION Buffer,BSS
  693. ;
  694. ;
  695.  
  696. bp_buffer    ds.b $208            ; bpsong-null
  697.  
  698.